package com.tools.generator.query;

import cn.hutool.core.util.StrUtil;
import com.tools.generator.enums.dbEnum;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Admin
 */
@Slf4j
public class SQLiteQuery implements AbstractQuery{
    @Override
    public dbEnum dbType() {
        return dbEnum.SQLite;
    }

    @Override
    public String tableSql(String tableName) {
        StringBuilder sql = new StringBuilder();
        sql.append("SELECT name,tbl_name FROM sqlite_master WHERE type='table' ");
        // 表名查询
        if (StrUtil.isNotBlank(tableName)) {
            sql.append("and name = '").append(tableName).append("' ");
        }
        sql.append("ORDER BY name");
        log.info("执行的SQL-->:{}", sql);
        return sql.toString();
    }

    @Override
    public String tableName() {
        return "name";
    }

    @Override
    public String tableComment() {
        return "tbl_name";
    }

    @Override
    public String tableFieldsSql() {
        return "";
    }

    @Override
    public String fieldName() {
        return "";
    }

    @Override
    public String fieldType() {
        return "";
    }

    @Override
    public String dataLength() {
        return null;
    }

    @Override
    public String fieldComment() {
        return "";
    }

    @Override
    public String fieldKey() {
        return "";
    }
}
